-
Notifications
You must be signed in to change notification settings - Fork 111
Add mcap recorder #3332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
patrickelectric
wants to merge
6
commits into
bluerobotics:master
Choose a base branch
from
patrickelectric:mcap
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Add mcap recorder #3332
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reviewer's GuideIntroduces a new MCAP logger service that subscribes to Zenoh topics, generates JSON schemas on-the-fly (including special handling for Foxglove logs), registers schemas and channels, and writes incoming messages into an MCAP file; also updates the project’s dependency lock file. Sequence Diagram: MCAP Logger Message HandlingsequenceDiagram
participant Z as Zenoh
participant MLS as McapLoggerService
participant MW as McapWriter
MLS ->> Z: Subscribe to key_expr
%% Message processing loop begins after subscription
Z ->> MLS: zenoh.Sample (message)
MLS ->> MLS: Parse JSON payload from sample
MLS ->> MLS: Validate parsed data
alt Data is valid and parsed
alt Topic's schema not yet in schema_map
alt Topic name ends with "/log" (Foxglove Log)
MLS ->> MW: register_schema(name="foxglove.Log", encoding="jsonschema", data=JSON_Log_Schema)
MW -->> MLS: schema_id
MLS ->> MW: register_channel(schema_id, topic, message_encoding="json")
MW -->> MLS: channel_id
MLS ->> MLS: Store schema_id in schema_map
MLS ->> MLS: Store channel_id in channel_map
else Regular Topic
MLS ->> MLS: create_schema(data) (using genson)
MW -->> MLS: schema_data (JSON bytes)
MLS ->> MW: register_schema(name=json_topic_name, encoding="jsonschema", data=schema_data)
MW -->> MLS: schema_id
MLS ->> MLS: Store schema_id in schema_map
end
end
alt Topic's channel not yet in channel_map AND not a Foxglove Log topic (whose channel was just registered)
MLS ->> MLS: Get schema_id from schema_map (for regular topic)
MLS ->> MW: register_channel(schema_id, topic, message_encoding="json")
MW -->> MLS: channel_id
MLS ->> MLS: Store channel_id in channel_map
end
MLS ->> MLS: Get channel_id from channel_map (guaranteed to be present now)
MLS ->> MLS: Get current timestamp (ts_ns)
MLS ->> MW: add_message(channel_id, log_time=ts_ns, publish_time=ts_ns, data=json.dumps(data).encode())
else Data is invalid or parsing failed
MLS ->> MLS: Log error/warning and skip message
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Signed-off-by: Patrick José Pereira patrickelectric@gmail.com
Summary by Sourcery
Add an MCAP recorder for Zenoh that dynamically generates JSON schemas and channels per topic, records incoming messages to an MCAP file, and exposes a CLI for subscription and logging configuration.
New Features:
Enhancements: